package testcase.framework;

import junit.framework.TestCase;

import org.junit.Before;
import org.junit.Test;

import satir.command.Command;
import satir.framework.LazyInitiator;

public class LazyInitiator_getCommand_1 extends TestCase {
	
	@Before
	public void setUp() throws Exception {
	}
	
	//Step 1, create a ViewBoardCmd
	@Test
	public void testGetCommandStep1() {
		Command cmd = (Command)LazyInitiator.get("ViewBoardCmd", "ViewBoardCmd",true);
		assertNotNull(cmd);
	}
	
	//Step 2, create another new ViewboardCmd, and get it from pool
	@Test
	public void testGetCommandStep2() {
		Command cmd = (Command)LazyInitiator.get("ViewBoardCmd", "ViewBoardCmd",true);
		Command cmd2 = (Command)LazyInitiator.get("ViewBoardCmd", "ViewBoardCmd",false);
		assertEquals(cmd, cmd2);
	}
	
	//Step 3, Create two different Object of ViewBoardCmd
	@Test
	public void testGetCommandStep3() {
		Command cmd = (Command)LazyInitiator.get("ViewBoardCmd", "ViewBoardCmd",true);
		Command cmd2 = (Command)LazyInitiator.get("ViewBoardCmd", "ViewBoardCmd",true);
		assertNotSame(cmd, cmd2);
	}

}
